
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>添加地址</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <!-- <link rel="shortcut icon" href="/favicon.ico"> -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="<%=basePath %>/resources/Public/Vendor/SUI/dist/css/sm.min.css">

    <link rel="stylesheet" href="<%=basePath %>/resources/Public/Vendor/SUI/dist/css/sm.min.css">
    <link rel="stylesheet" href="<%=basePath %>/resources/Public/Vendor/SUI/dist/css/sm-extend.min.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath %>/resources/Public/Vendor/icon/iconfont.css">

    <link rel="stylesheet" href="<%=basePath %>/resources/Public/css/common.css">

</head>
<body>
<div class="page-group">
    <div class="page xgj-addAdress" id='xgj-addAdress'>
        <div class="content ">
            <div class="list-block">
                <ul>
                    <li>
                        <div class="item-content">
                            <div class="item-inner">
                                <div class="item-title label">收货人</div>
                                <div class="item-input">
                                    <input type="text" id="name" placeholder="点击输入">
                                </div>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="item-content">
                            <div class="item-inner">
                                <div class="item-title label">联系电话</div>
                                <div class="item-input">
                                    <input type="number" id="phone" placeholder="点击输入">
                                </div>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="item-content">
                            <div class="item-inner">
                                <div class="item-title label">所在地区</div>
                                <div class="item-input">
                                    <input type="text" id='city-picker' value="浙江 杭州 西湖区" />
                                </div>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="item-content">
                            <div class="item-inner">
                                <textarea name="" id="address" placeholder="详细楼号，楼层，厅室"></textarea>
                            </div>
                        </div>
                    </li>

                </ul>

            </div>
            <nav class="bar bar-tab xgj-bar-btn">
                <p><a href="javascript:addAddress()" class="">新增地址</a></p>
            </nav>
        </div>
    </div>
    <!--   此处引入 _footer.html -->
    <script src='<%=basePath %>/resources/Public/Vendor/SUI/dist/js/zepto.js'></script>
    <script type="text/javascript">
        $.config = {
            // 路由功能开关过滤器，返回 false 表示当前点击链接不使用路由
            routerFilter: function($link) {
                // 某个区域的 a 链接不想使用路由功能
                if ($link.is('.disable-router a')) {
                    return false;
                }
                return true;
            }
        };
    </script>
    <script src='<%=basePath %>/resources/Public/Vendor/SUI/dist/js/sm.js'></script>
    <script src="<%=basePath %>/resources/Public/Vendor/SUI/dist/js/sm-city-picker.min.js" ></script>
    <script src='<%=basePath %>/resources/Public/Vendor/SUI/dist/js/sm-extend.min.js'></script>
    <script src='<%=basePath %>/resources/Public/js/common.js'></script>
    <!-- / 此处引入 _footer.html -->


    <script type="text/javascript">
        $.init();
        function addAddress(){
            $.ajax({
                url: "<%=path%>/wx/add/addAddress.do",
                method: 'GET',
                dataType: 'json',
                data: {
                    uName:$("#name").val(),
                    aphone:$("#phone").val(),
                    citys:$("#city-picker").val(),
                    address:$("#address").val()
                },
                success: function(data){
                    if(data.result=="0000"){
                        $.toast("添加成功！");
                        setTimeout(toListAddress, 2000);

                    }else{
                        $.toast("添加失败！");
                    }

                }
            });
        }

        function toListAddress() {
            window.location.href="<%=basePath %>/wx/add/address_list.do";
        }
    </script>

</body>
</html>